#ifndef __MYLIST_H__
#define __MYLIST_H__

#include "myhead.h"
#include "msg.h"

typedef struct _node{
    char name[20];
    char psword[20];
    struct sockaddr_in clientaddr;
    int client_sockfd;
    int heart_num;
    int verify;                     //校验，用于校验是否重复登录
    char devnum[20];                //设备号
    pthread_t tid;
	
	struct _node *next;
}list_t;


//链表相关
list_t *get_pcclient_list_head();
list_t *get_device_list_head();
void list_init(list_t *head);
int list_add_head(list_t *head, list_t *node);
int list_add_tail(list_t *head, list_t *node);
int list_del_head(list_t *head);
int list_del_node(list_t *head, int fd);
int list_find_verify(list_t *head, int verify);
int list_find_devnum(list_t *head, char *devnum);
int list_traverse(list_t *head);

//队列相关
int *get_qtod_queue();
int *get_dtoq_queue();
int msg_queue_init(int *msgid, char ch);
int msg_send_to_queue(int *msgid, msg_queue_t *clientmsg);
int msg_recv_to_queue(int *msgid, msg_queue_t *clientmsg, long msgtype);

#endif
